import '../bean/dropswitch_bean.dart';
import '../utils/api/http.dart';
import '../utils/tools/localstorage_tool.dart';

class DropSwitch {

  /// 获取跌落开关信息
  /// * [par] Map|必填|台区id
  static Future reqDropSwitchInfo(par) async {
    List<DropSwitchBean> list = [];
    String token = await LocalStorage.getStringItem("token");
    var res = await HttpManager.getInstance().get('dropSwitch/getNewestPmDropSwitchData?token=${token}', params: par);
    if(res["data"] != null){
      res["data"].forEach((key, value){
        list.add(DropSwitchBean(key,value));
      });
      return list;
    } else {
      return null;
    }
  }
}